// src/api/login_api.js
import http from '../util/request.js'

export default {
    // 获取验证码
    captcha: () => {
        return http({
            url: '/login/captcha',
            method: 'GET'
        });
    },

    // 管理员登录
    managerLogin: (obj) => {
        const loginData = {
            username: obj.username,
            password: obj.password
        };

        return http({
            url: '/login/managerLogin?captcha=' + obj.captcha + '&key=' + obj.key,
            method: 'POST',
            data: loginData,
            headers: {
                'Content-Type': 'application/json'
            }
        });
    },

    // 游客登录
    visitorLogin: (obj) => {
        // 移除 FormData，直接发送 JSON 对象
        const loginData = {
            username: obj.username,
            password: obj.password
        };

        return http({
            url: '/login/visitorLogin?captcha=' + obj.captcha + '&key=' + obj.key,
            method: 'POST',
            data: loginData,
            headers: {
                'Content-Type': 'application/json'
            }
        });
    },

    // 地陪登录
    guideLogin: (obj) => {
        // 移除 FormData，直接发送 JSON 对象
        const loginData = {
            username: obj.username,
            password: obj.password
        };

        return http({
            url: '/login/guideLogin?captcha=' + obj.captcha + '&key=' + obj.key,
            method: 'POST',
            data: loginData,
            headers: {
                'Content-Type': 'application/json'
            }
        });
    },

    //获取token信息
    loginInfo: () => {
        return http({
            url: '/login/loginInfo',
            method: 'GET'
        });
    },

}